<?php

if (function_exists('add_theme_support')) {
    add_theme_support('post-thumbnails');
}
// Set path to Slope Framework and theme specific functions
$admin_path = TEMPLATEPATH . '/admin-functions/';
$include_path = TEMPLATEPATH . '/stInclude/';
require_once $include_path . '/libs/functions/core.php';
require_once $include_path . '/libs/classes/stthemehook.php';
require_once $include_path . '/libs/classes/stthemefunctions.php';
require_once $include_path . '/libs/classes/stthememodel.php';
require_once $include_path . '/libs/classes/stthemeview.php';
require_once $include_path . '/libs/classes/stwidgets.php';

// Add hook function
$config = include $include_path . 'config.php';
if (is_admin()) {
    require_once ($admin_path . 'admin.php');
} else {
    require_once $admin_path . 'fhook.php';
    $fhook = new fhook($config);
}
do_action($config['theme_name'] . '_extra_contruction');

function new_excerpt_length($length) {
    return 28;
}

add_filter('excerpt_length', 'new_excerpt_length');

function custom_excerpt_more($more) {
    return '';
}

add_filter('excerpt_more', 'custom_excerpt_more');


function get_cat_slug($cat_id) {
  $cat_id = (int) $cat_id;
  $category = &get_category($cat_id);
  return $category->slug;
}

function get_custom_content($content,$length = 100 ) {
	$xexcerpt = strip_tags($content);  
	return  substr($xexcerpt, 0, strripos(substr($xexcerpt,0, $length), ' '));   
} 


function curPageURL() {
 $pageURL = 'http';
 if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
 $pageURL .= "://";
 if ($_SERVER["SERVER_PORT"] != "80") {
  $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
 } else {
  $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
 }
 return $pageURL;
}